package com.yitiao.socket.chatroom.aio;

import com.yitiao.socket.chatroom.MyClient;
import lombok.SneakyThrows;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class AioClientInputHandler implements Runnable{
    public MyClient client;

    public AioClientInputHandler(MyClient client) {
        this.client = client;
    }

    @SneakyThrows
    @Override
    public void run() {
        BufferedReader systemReader = new BufferedReader(new InputStreamReader(System.in));

        while (!client.isQuit){
            String line = systemReader.readLine();

            if (line!=null){
                client.send(line);
//                if (line.equals(CommonConst.QUIT)){
//                    client.close();
//                }
            }
        }
    }
}
